from sqlalchemy import Column, Integer, String, Boolean, Text, JSON
from commons.database import Base


class User(Base):
    """用户表模型，存储用户基本信息、企业信息和个体工商信息"""
    __tablename__ = "users"

    id = Column(Integer, primary_key=True, autoincrement=True, comment="用户ID")
    openid = Column(String(50), unique=True, nullable=False, comment="第三方平台唯一标识")
    nickname = Column(String(100), comment="用户昵称")
    telephone = Column(String(20), comment="联系电话")
    address = Column(String(200), comment="联系地址")
    is_admin = Column(Boolean, default=False, comment="是否管理员")
    is_approved = Column(Boolean, default=False, comment="是否审核通过")
    is_seller = Column(Boolean, default=False, comment="是否为卖家")
    is_enterprise = Column(Boolean, default=False, comment="是否企业用户")
    company_name = Column(String(100), comment="企业名称")
    company_address = Column(String(200), comment="企业地址")
    company_legal_person = Column(String(50), comment="企业法人")
    business_license = Column(String(200), comment="营业执照路径")
    company_bank_account_name = Column(String(100), comment="银行公户名称")
    company_bank_account_number = Column(String(50), comment="银行公户账号")
    individual_business_name = Column(String(100), comment="个体工商名称")
    individual_business_address = Column(String(200), comment="个体工商地址")
    individual_business_operator = Column(String(50), comment="个体工商经营者")
    personal_bank_account_name = Column(String(50), comment="个人银行账户名称")
    personal_bank_account_number = Column(String(50), comment="个人银行账号")
    introduction = Column(Text, comment="用户简介")
    album = Column(JSON, comment="相册图片路径列表")